package com.example.model23.test2;

// 上下文环境
    public class Context {
        private Strategy strategy;

        public Context(Strategy strategy) {
            this.strategy = strategy;
        }

        public void setStrategy(Strategy strategy) {
            this.strategy = strategy;
        }

        public double executeStrategy(double num1, double num2) {
            return strategy.doOperation(num1, num2);
        }
    }